package day06;
//方法演示
public class MethodDemo {
    public static void main(String[] args) {
        //say();
        //sayHi("wxy");
        //sayHello("zhangsan",50);
        //sayHello("lisi",80);
        //sayHello("wangwu",24);
        double a = getNum();
        //System.out.println(a);
        //System.out.println(getNum());
        int b = plus(3,5);
       // System.out.println(b);
        int m = 4, n=6;
        int c = m+n;
        //System.out.println(c);
        int[] arr = testArray();
        //System.out.println("数组的第一个元素为:"+arr[0]);
        //System.out.println("数组的长度为:"+arr.length);
        //for (int i = 0; i < arr.length; i++) {
            //System.out.println(arr[i]);
        //}

        int[] arradd = testArrayadd(5,100);
        /*for (int i = 0; i < arradd.length ; i++) {
            System.out.println(arradd[i]);
        }
         */

        //aMethod();
        //System.out.println(444);

    }
    public static void say(){
        System.out.println("我叫WXY，今年24岁了");
    }
    public static void sayHi(String name){
        System.out.println("我叫"+name+"，今年24岁了");
    }
    public static void sayHello(String name,int age){
        if (age>70){
            return;
        }
        System.out.println("我叫"+name+"，今年"+age+"岁了");
    }
    public static double getNum(){
        return 10.0;
    }
    public static int plus(int num1,int num2 ){
        int num =num1+num2;
        return num;
    }
    public static int[] testArray(){
        int[] arr = new int[10];
        for (int i = 0; i < arr.length ; i++) {
            arr[i] = (int)(Math.random()*100);
        }
        return arr;
    }
    public static int[] testArrayadd(int len,int max){
        int[] arr = new int[len];
        for (int i = 0; i < arr.length ; i++) {
            arr[i] = (int)(Math.random()*(max+1));
        }
        return arr;
    }
    public static void aMethod(){
        System.out.println(111);
        bMethod();
        System.out.println(222);
    }
    public static void bMethod(){
        System.out.println(333);
    }

}
